// 时间戳转日期
const timeTodate = function(timestamp, format) {
	var formateArr = ['Y', 'm', 'd', 'H', 'i', 's'];
	var returnArr = [];

	var date = new Date(parseInt(timestamp) * 1000)

	returnArr.push(date.getFullYear());

	var month = date.getMonth() + 1;
	month = month < 10 ? '0' + month : month
	returnArr.push(month);

	var day = date.getDate()
	day = day < 10 ? '0' + day : day
	returnArr.push(day);

	var hours = date.getHours()
	hours = hours < 10 ? '0' + hours : hours
	returnArr.push(hours);

	var minute = date.getMinutes()
	minute = minute < 10 ? '0' + minute : minute
	returnArr.push(minute);

	var second = date.getSeconds()
	second = second < 10 ? '0' + second : second
	returnArr.push(second);

	returnArr.forEach(function(v, i) {
		format = format.replace(formateArr[i], returnArr[i]);
	})
	return format;
}


// 强密码验证
export const passwordCheck = (password) => {
	//8-30位 必须要3种组合（数字、字母、特殊字符）
	var reg = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,30}');
	return reg.test(password)
}

// 测试方法
export const  al = () => {　
　alert(999)
}　


export default {
  al,
  passwordCheck,
  timeTodate
}
